fix(navigation): preserve user transitions across directional navigation#11
Merged
Conversation
handleNavigation merged directional transitions on top of el.transition,
silently clobbering any developer-supplied transition keys. The empty
`transition={/* @once */ {}}` default on Row/Column/Virtual also blocked
style-defined transitions because elementNode's style setter skips keys
that are already defined on the node.
- handleNavigation now snapshots the developer's base transition and
merges as `{ ...directional, ...base }` so user-supplied keys win.
Re-snapshots when el.transition is changed externally (reactive update).
- Drop empty `transition={{}}` defaults from Row, Column, and Virtual so
`style.transition` flows through.
Fixes #8
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
handleNavigationnow snapshots the developer-suppliedtransitionand merges as{ ...directional, ...base }so user-supplied keys (e.g. a customtransition.xduration) survive every keypress instead of being clobbered bydefaultTransitionBack/Forward/Up/Down. The snapshot is re-taken wheneverel.transitionis set externally, so reactive updates still flow through.transition={/* @once */ {}}default fromRow,Column, andVirtual. That default madethis.transitionnon-undefined beforeelementNode's style setter ran, which caused the setter to skipstyle.transitionentirely (elementNode.ts:1141-1145).handleNavigationalready tolerates an undefinedel.transition, so the default isn't load-bearing.Fixes #8
Test plan
npm run tsc— cleannpm test— 120/120 passingtransition={{ x: { duration: 500 } }}on aRowkeeps that duration after pressing left/rightstyle={{ transition: { x: {...} } }}on aRowis now honored🤖 Generated with Claude Code